
<script language="JavaScript" type="text/javascript">
<!--
function set_project( name )
{
  document.project_select_form.project.value = name;
  document.project_select_form.submit() ;
}

function delete_project( name )
{
  var check = confirm('Are you sure?');
  if (check == true) {
      document.project_delete_form.project.value = name;
      document.project_delete_form.submit();
      return true;
  }
  else {
      return false;
  }
}
-->
</script>
<div class="row">
<div class="col-sm-8">
  <form class="form-inline" name="project_select_form" action="/project" method="post">
    <div class="form-group">
      <label for="project" class="control-label">Create a new project:</label>
      <input type="text" class="form-control input-sm" id="project" name="project" value=""/>
      <input class="btn btn-primary btn-sm" type="submit" value="Submit" />
    </div>
  </form>
  <form name="project_delete_form" action="/project/delete" method="post"><input type="hidden" id="project" name="project"/></form>
Or select an existing project:
<p>
<ul>
<% Intrigue::Model::Project.order(:name).each do |p| %>
  <li>
    <a href="javascript:set_project('<%= p.name %>')"> <%= h p.name %></a> (<%= p.entities.count %> entities) <a href="javascript:delete_project('<%= p.name %>')">[x]</a>
  </li>
<% end %>
</ul>
</div>
</div>
